var theMap = null;
function document_load(){
  zoyoe.InitZoyoe();
  ShowRightSideBar();
  theMap = new MapInfoCore(function(rmap){
    sdist(rmap)
  },null,"map-info")
}
function sdist(ret_map){
  YUI().use('io-form',function(IO){
    var uri = ("/adult/core/data/getservices/?tstmp={{TIME_STAMP}}");
    zoyoe.map = ret_map;
    function complete(io,o,args){
      var s_element = o.responseXML.documentElement.getElementsByTagName('SERVICE');
      for(var i=0;i<s_element.length;i++){
        var element = s_element[i];
        var service = new Service(element);
        ret_map.AddService(service);
      }
      ret_map.ShiftZoom(true);
      zoyoe.SwitchDockStyle('ICON');
      InitDrag();
      MarkAsScroll(document.getElementById('age-scroll'),
        function cb(lp,hp){
          document.getElementById('age-range-hint').innerHTML = parseInt(lp/3+16)+'/'+parseInt(hp/3+16);
        },
        function dcb(lp,hp){
        var low = parseInt(lp/3+16);
        var high = parseInt(hp/3+16);
        document.getElementById('age-range-hint').innerHTML = low+"/"+high;
        ret_map.ResetAgeFilter(low,high);
        }
      );
      MarkAsScroll(document.getElementById('rate-scroll'),
        function (lp,hp){
          document.getElementById('rate-range-hint').innerHTML = parseInt(lp)+'/'+parseInt(hp);
        },
        function (lp,hp){
          document.getElementById('rate-range-hint').innerHTML = parseInt(lp)+'/'+parseInt(hp);
        }
      );
      InitControlPanel();
      window.onresize = function(){
        //ret_map.map.Resize();
        ShowRightSideBar();
      }
    }
    IO.on('io:complete',complete);
    var request = IO.io(uri);
  });
  /*xslt.load("service_list_xslt.xsl");*/
  return true;
}

